import request from '@/utils/request';

const API = {
    // 获取验证码图像
    CAPTCHAIMG_URL: '/v1/user/accounts/code',
    // 获取TOKEN
    GETTOKEN_URL: '/v1/user/accounts/login',
    // 登录成功跳转页面
    LOGIN_URL: '/v1/biz/logins/getUserInfoByJWT',
    // 获取加密信息
    GET_KEY_URL: '/v1/biz/logins/entrySsti',
    // 获取微信token
    GET_TOKEN_ABOUT_WX_URL: '/v1/biz/logins/loginWx'
};

// 获取验证码图像
export const reqCaptchaImage = () =>
    request.post(API.CAPTCHAIMG_URL, {}, { responseType: 'blob' });

// 获取TOKEN
export const reqToken = data => request.post(API.GETTOKEN_URL, data);

// 登录成功跳转页面
export const reqLogin = () => request.get(API.LOGIN_URL);

// 获取加密信息
export const reqKey = () => request.get(`${API.GET_KEY_URL}?verson=1.0`);

// 获取token
export const reqWXToken = replyInfo =>
    request.get(`${API.GET_TOKEN_ABOUT_WX_URL}?replyInfo=${replyInfo}`);
